const express = require("express");
const router = express.Router();
const areaService = require("./service/AreaServiceImpl");

// 新增修改区域
router.post("/saveOrUpdate", (req, res, next) => {
  areaService.saveOrUpdate(req, res, next);
});

// 获取区域列表
router.post("/getAreaTree", (req, res, next) => {
  areaService.getAreaTree(req, res, next);
});

// 给区域绑定路径
router.post("/bindPicUrl", (req, res, next) => {
  areaService.bindPicUrl(req, res, next);
});

// 给区域绑定图标
router.post("/bindIcon", (req, res, next) => {
  areaService.bindIcon(req, res, next);
});

// 获取区域中的所有的绑定数据
router.post("/getAllBindData", (req, res, next) => {
  areaService.getAllBindData(req, res, next);
});

// 删除区域 需先删除下级区域
router.post("/deleteWithoutSub", (req, res, next) => {
  areaService.deleteWithoutSub(req, res, next);
});

// 删除区域 会删除所有下级区域
router.post("/deleteAllSub", (req, res, next) => {
  areaService.deleteAllSub(req, res, next);
});

module.exports = router;
